import Vue from 'vue';
import axios from './router/axios';
import VueAxios from 'vue-axios';
import App from './App';
import router from './router/router';
import './permission'; // 权限
import store from './store';
import {loadStyle} from './util/util'
import * as urls from '@/config/env';
import "./vuePrototypeFun"
import "./vueComponents"
import i18n from "@/lang";
import {iconfontUrl, iconfontVersion} from '@/config/env';
import './styles/common.scss';
import website from '@/config/website';
import crudCommon from '@/mixins/crud';
import request from "../src/router/axios"
//引入rem
import "../src/util/rem"

import microApp from '@micro-zoe/micro-app'

microApp.start({
    globalAssets: {
        js: [],
        css: [],
    }
})

// 注册全局crud驱动
window.$crudCommon = crudCommon;
// 加载Vue拓展
Vue.use(router);
Vue.use(VueAxios, axios);

Vue.use(window.AVUE, {
    size: 'small',
    tableSize: 'small',
    calcHeight: 65,
    i18n: (key, value) => i18n.t(key, value)
});
// 加载相关url地址
Object.keys(urls).forEach(key => {
    Vue.prototype[key] = urls[key];
});
// 加载website
Vue.prototype.website = website;
// 动态加载阿里云字体库
// iconfontVersion.forEach(ele => {
//     loadStyle(iconfontUrl.replace('$key', ele));
// });

Vue.config.productionTip = false;

// 调用指定文件 向全局插入公共组件
/*(async function (src) {
    const res = await request({method: "get", url: src})
    new Function(res.data)();
    let componentObj = window['comTemplate'].default;

    for (const key in componentObj) {
        Vue.component(key, () => {
            return new Promise((resolve) => {
                resolve(componentObj[key])
            })
        })
    }

})("/dpi/comTemplate.umd.js")*/

new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount('#app');
